3.3.100 \(\int \frac {(c+d x^n)^2}{a+b x^n} \, dx\) [300]

Optimal. Leaf size=84 \[ -\frac {d (a d (1+n)-b (c+2 c n)) x}{b^2 (1+n)}+\frac {d x \left (c+d x^n\right )}{b (1+n)}+\frac {(b c-a d)^2 x \, _2F_1\left (1,\frac {1}{n};1+\frac {1}{n};-\frac {b x^n}{a}\right )}{a b^2} \]

[Out]

-d*(a*d*(1+n)-b*(2*c*n+c))*x/b^2/(1+n)+d*x*(c+d*x^n)/b/(1+n)+(-a*d+b*c)^2*x*hypergeom([1, 1/n],[1+1/n],-b*x^n/
a)/a/b^2

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 84, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {427, 396, 251} \begin {gather*} \frac {x (b c-a d)^2 \, _2F_1\left (1,\frac {1}{n};1+\frac {1}{n};-\frac {b x^n}{a}\right )}{a b^2}-\frac {d x (a d (n+1)-b (2 c n+c))}{b^2 (n+1)}+\frac {d x \left (c+d x^n\right )}{b (n+1)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*x^n)^2/(a + b*x^n),x]

[Out]

-((d*(a*d*(1 + n) - b*(c + 2*c*n))*x)/(b^2*(1 + n))) + (d*x*(c + d*x^n))/(b*(1 + n)) + ((b*c - a*d)^2*x*Hyperg
eometric2F1[1, n^(-1), 1 + n^(-1), -((b*x^n)/a)])/(a*b^2)

Rule 251

Int[((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[a^p*x*Hypergeometric2F1[-p, 1/n, 1/n + 1, (-b)*(x^n/a)],
x] /; FreeQ[{a, b, n, p}, x] &&  !IGtQ[p, 0] &&  !IntegerQ[1/n] &&  !ILtQ[Simplify[1/n + p], 0] && (IntegerQ[p
] || GtQ[a, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 427

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Simp[d*x*(a + b*x^n)^(p + 1)*((c
 + d*x^n)^(q - 1)/(b*(n*(p + q) + 1))), x] + Dist[1/(b*(n*(p + q) + 1)), Int[(a + b*x^n)^p*(c + d*x^n)^(q - 2)
*Simp[c*(b*c*(n*(p + q) + 1) - a*d) + d*(b*c*(n*(p + 2*q - 1) + 1) - a*d*(n*(q - 1) + 1))*x^n, x], x], x] /; F
reeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && GtQ[q, 1] && NeQ[n*(p + q) + 1, 0] &&  !IGtQ[p, 1] && IntB
inomialQ[a, b, c, d, n, p, q, x]

Rubi steps

\begin {align*} \int \frac {\left (c+d x^n\right )^2}{a+b x^n} \, dx &=\frac {d x \left (c+d x^n\right )}{b (1+n)}+\frac {\int \frac {-c (a d-b c (1+n))-d (a d (1+n)-b (c+2 c n)) x^n}{a+b x^n} \, dx}{b (1+n)}\\ &=-\frac {d (a d (1+n)-b (c+2 c n)) x}{b^2 (1+n)}+\frac {d x \left (c+d x^n\right )}{b (1+n)}+\frac {(b c-a d)^2 \int \frac {1}{a+b x^n} \, dx}{b^2}\\ &=-\frac {d (a d (1+n)-b (c+2 c n)) x}{b^2 (1+n)}+\frac {d x \left (c+d x^n\right )}{b (1+n)}+\frac {(b c-a d)^2 x \, _2F_1\left (1,\frac {1}{n};1+\frac {1}{n};-\frac {b x^n}{a}\right )}{a b^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains higher order function than in optimal. Order 9 vs. order 5 in optimal.
time = 0.31, size = 75, normalized size = 0.89 \begin {gather*} \frac {x \left (2 c d x^n \Phi \left (-\frac {b x^n}{a},1,1+\frac {1}{n}\right )+d^2 x^{2 n} \Phi \left (-\frac {b x^n}{a},1,2+\frac {1}{n}\right )+c^2 \Phi \left (-\frac {b x^n}{a},1,\frac {1}{n}\right )\right )}{a n} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x^n)^2/(a + b*x^n),x]

[Out]

(x*(2*c*d*x^n*HurwitzLerchPhi[-((b*x^n)/a), 1, 1 + n^(-1)] + d^2*x^(2*n)*HurwitzLerchPhi[-((b*x^n)/a), 1, 2 +
n^(-1)] + c^2*HurwitzLerchPhi[-((b*x^n)/a), 1, n^(-1)]))/(a*n)

________________________________________________________________________________________

Maple [F]
time = 0.01, size = 0, normalized size = 0.00 \[\int \frac {\left (c +d \,x^{n}\right )^{2}}{a +b \,x^{n}}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*x^n)^2/(a+b*x^n),x)

[Out]

int((c+d*x^n)^2/(a+b*x^n),x)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*x^n)^2/(a+b*x^n),x, algorithm="maxima")

[Out]

(b^2*c^2 - 2*a*b*c*d + a^2*d^2)*integrate(1/(b^3*x^n + a*b^2), x) + (b*d^2*x*x^n + (2*b*c*d*(n + 1) - a*d^2*(n
 + 1))*x)/(b^2*(n + 1))

________________________________________________________________________________________

Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*x^n)^2/(a+b*x^n),x, algorithm="fricas")

[Out]

integral((d^2*x^(2*n) + 2*c*d*x^n + c^2)/(b*x^n + a), x)

________________________________________________________________________________________

Sympy [C] Result contains complex when optimal does not.
time = 1.97, size = 170, normalized size = 2.02 \begin {gather*} - \frac {2 c d x \Phi \left (\frac {a x^{- n} e^{i \pi }}{b}, 1, \frac {e^{i \pi }}{n}\right ) \Gamma \left (\frac {1}{n}\right )}{b n^{2} \Gamma \left (1 + \frac {1}{n}\right )} + \frac {c^{2} x \Phi \left (\frac {b x^{n} e^{i \pi }}{a}, 1, \frac {1}{n}\right ) \Gamma \left (\frac {1}{n}\right )}{a n^{2} \Gamma \left (1 + \frac {1}{n}\right )} + \frac {2 d^{2} x x^{2 n} \Phi \left (\frac {b x^{n} e^{i \pi }}{a}, 1, 2 + \frac {1}{n}\right ) \Gamma \left (2 + \frac {1}{n}\right )}{a n \Gamma \left (3 + \frac {1}{n}\right )} + \frac {d^{2} x x^{2 n} \Phi \left (\frac {b x^{n} e^{i \pi }}{a}, 1, 2 + \frac {1}{n}\right ) \Gamma \left (2 + \frac {1}{n}\right )}{a n^{2} \Gamma \left (3 + \frac {1}{n}\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*x**n)**2/(a+b*x**n),x)

[Out]

-2*c*d*x*lerchphi(a*exp_polar(I*pi)/(b*x**n), 1, exp_polar(I*pi)/n)*gamma(1/n)/(b*n**2*gamma(1 + 1/n)) + c**2*
x*lerchphi(b*x**n*exp_polar(I*pi)/a, 1, 1/n)*gamma(1/n)/(a*n**2*gamma(1 + 1/n)) + 2*d**2*x*x**(2*n)*lerchphi(b
*x**n*exp_polar(I*pi)/a, 1, 2 + 1/n)*gamma(2 + 1/n)/(a*n*gamma(3 + 1/n)) + d**2*x*x**(2*n)*lerchphi(b*x**n*exp
_polar(I*pi)/a, 1, 2 + 1/n)*gamma(2 + 1/n)/(a*n**2*gamma(3 + 1/n))

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*x^n)^2/(a+b*x^n),x, algorithm="giac")

[Out]

integrate((d*x^n + c)^2/(b*x^n + a), x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {{\left (c+d\,x^n\right )}^2}{a+b\,x^n} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d*x^n)^2/(a + b*x^n),x)

[Out]

int((c + d*x^n)^2/(a + b*x^n), x)

________________________________________________________________________________________